package routers

import (
	"github.com/astaxie/beego"
	"pq/controllers"
	"pq/controllers/v1"
)


func init() {

    beego.Router("/", &controllers.MainController{})
	ns := beego.NewNamespace("/v1",

		//beego.NSRouter("/auth", &controllers.AuthController{},"*:AdminLogin"),
		//beego.NSRouter("/login",&controllers.AuthController{},"*:Login"),
		//
	    //beego.NSRouter("/register/student",&controllers.AuthController{},"*:Register"),
		beego.NSRouter("/area/province",&v1.AreaController{},"get:ListProvince"),
		beego.NSRouter("/area/city",&v1.AreaController{},"get:ListCity"),
		beego.NSRouter("/area/all",&v1.AreaController{},"get:ListAll"),
		beego.NSRouter("/area/all",&v1.TokenCheckController{},"options:Option"),
		beego.NSRouter("/users/avatar",&v1.BaseController{},"post:Upload"),
		beego.NSRouter("/users/avatar",&v1.TokenCheckController{},"options:Option"),

		beego.NSRouter("/users",&v1.UserController{},"get:Get"),
		beego.NSRouter("/users",&v1.UserController{},"post:Post"),
		beego.NSRouter("/users/:id",&v1.UserController{},"delete:Del"),
		beego.NSRouter("/users",&v1.TokenCheckController{},"options:Option"),
		beego.NSRouter("/users/:id",&v1.TokenCheckController{},"options:Option"),

		beego.NSRouter("/user/info",&v1.TokenCheckController{},"options:Option"),
		beego.NSRouter("/user/info",&v1.UserController{},"get:GetInfo"),
		beego.NSRouter("/user/stat",&v1.StatController{},"get:GetUserStat"),
		beego.NSRouter("/user/stat",&v1.TokenCheckController{},"options:Option"),

		beego.NSRouter("/user/test_category",&v1.TokenCheckController{},"options:Option"),
		beego.NSRouter("/user/test_category",&v1.UserController{},"put:UpdateCategory"),

		beego.NSRouter("/user/area",&v1.TokenCheckController{},"options:Option"),
		beego.NSRouter("/user/area",&v1.UserController{},"put:UpdateArea"),

		// unsafe methods
		beego.NSRouter("/user/info-of-phone",&v1.TokenCheckController{},"options:Option"),
		beego.NSRouter("/user/info-of-phone",&v1.UserController{},"get:GetInfoByPhone"),

		beego.NSRouter("/user/area-by-phone",&v1.TokenCheckController{},"options:Option"),
		beego.NSRouter("/user/area-by-phone",&v1.UserController{},"put:UpdateAreaCode"),

		beego.NSRouter("/user/test_category/point_category",&v1.TestCategoryController{},"get:GetPointsCategory"),
		beego.NSRouter("/user/test_category/point_category",&v1.TokenCheckController{},"options:Option"),

		beego.NSRouter("/test_categories",&v1.TestCategoryController{},"*:List"),
		beego.NSRouter("/test_categories/area",&v1.TestCategoryController{},"*:ListArea"),
		beego.NSRouter("/test_categories/area",&v1.TestCategoryController{},"options:Option"),
		beego.NSRouter("/test_categories/code/:code",&v1.TestCategoryController{},"*:ListByCode"),
		beego.NSRouter("/test_categories/code/:code",&v1.TestCategoryController{},"options:Option"),
		beego.NSRouter("/test_category",&v1.TestCategoryController{},"post,put:Store"),
		beego.NSRouter("/test_category",&v1.TestCategoryController{},"options:Option"),
		beego.NSRouter("/test_category/:id",&v1.TestCategoryController{},"delete:Del"),
		beego.NSRouter("/test_category/:id",&v1.TestCategoryController{},"options:Option"),
		beego.NSRouter("/test_category/:id",&v1.TestCategoryController{},"get:GetOne"),
		beego.NSRouter("/test_category/manage/regenerate",&v1.TestCategoryController{},"post:Regenerate"),
		beego.NSRouter("/test_category/manage/regenerate",&v1.TestCategoryController{},"options:Option"),
		beego.NSRouter("/test_category/manage/rensection",&v1.TestCategoryController{},"post:RenSection"),
		beego.NSRouter("/test_category/manage/rensection",&v1.TestCategoryController{},"options:Option"),
		beego.NSRouter("/test_categories/:id/setting",&v1.TestCategoryController{},"post:StorePointSetting"),
		beego.NSRouter("/test_categories/:id/setting2",&v1.TestCategoryController{},"post:StorePointSetting2"),
		beego.NSRouter("/test_categories/:id/setting",&v1.TestCategoryController{},"options:Option"),
		beego.NSRouter("/test_categories/:id/setting2",&v1.TestCategoryController{},"options:Option"),

		beego.NSRouter("/point_categories",&v1.PointCategoryController{},"*:List"),
		beego.NSRouter("/point_categories/code/:code",&v1.PointCategoryController{},"*:ListByCode"),
		beego.NSRouter("/point_categories/code/:code",&v1.PointCategoryController{},"options:Option"),
		beego.NSRouter("/point_category",&v1.PointCategoryController{},"post,put:Store"),
		beego.NSRouter("/point_category",&v1.PointCategoryController{},"options:Option"),
		beego.NSRouter("/point_category/:id",&v1.PointCategoryController{},"delete:Del"),
		beego.NSRouter("/point_category/:id",&v1.PointCategoryController{},"options:Option"),
		beego.NSRouter("/test_point_category/manage/regenerate",&v1.PointCategoryController{},"post:Regenerate"),
		beego.NSRouter("/test_point_category/manage/regenerate",&v1.PointCategoryController{},"options:Option"),


		beego.NSRouter("/cs_test_libraries",&v1.CsTestLibController{},"get:GetForFront"),
		beego.NSRouter("/cs_test_libraries_back",&v1.CsTestLibController{},"get:GetForBack"),
		beego.NSRouter("/cs_test_libraries",&v1.CsTestLibController{},"post:Post"),
		beego.NSRouter("/cs_test_libraries/:id",&v1.CsTestLibController{},"delete:Del"),
		beego.NSRouter("/cs_test_libraries/:id",&v1.CsTestLibController{},"get:GetOne"),
		beego.NSRouter("/cs_test_libraries/:id",&v1.CsTestLibController{},"options:Option"),
		beego.NSRouter("/cs_test_libraries",&v1.CsTestLibController{},"options:Option"),
		beego.NSRouter("/cs_test_libraries_back",&v1.CsTestLibController{},"options:Option"),
		beego.NSRouter("/cs_test_libraries_mylist",&v1.CsTestLibController{},"get:GetMyList"),
		beego.NSRouter("/cs_test_libraries_mylist",&v1.CsTestLibController{},"options:Option"),

		beego.NSRouter("/cs_last_test",&v1.CsTestLibController{},"get:GetMyLastTest"),
		beego.NSRouter("/cs_last_test",&v1.CsTestLibController{},"options:Option"),

		beego.NSRouter("/cs_test_libraries/:id/submit",&v1.CsTestLibController{},"post:Submit"),
		beego.NSRouter("/cs_test_libraries/:id/submit",&v1.CsTestLibController{},"options:Option"),


		beego.NSRouter("/cs_test_libraries/simu/:simu_id",&v1.CsTestLibItemController{},"options:Option"),

		beego.NSRouter("/cs_test_libraries_item/:id",&v1.CsTestLibItemController{},"get:Get"),
		beego.NSRouter("/cs_test_libraries/simu/:simu_id",&v1.CsTestLibItemController{},"get:GetSimu"),
		beego.NSRouter("/cs_test_libraries/simu/:simu_id",&v1.CsTestLibItemController{},"put:UpdateSimu"),
		beego.NSRouter("/cs_test_libraries_item/:id",&v1.CsTestLibItemController{},"post:Post"),
		beego.NSRouter("/cs_test_libraries_item/:id",&v1.CsTestLibItemController{},"delete:Del"),
		beego.NSRouter("/cs_test_libraries_item/simu/:id",&v1.CsTestLibItemController{},"get:ListSimuItems"),
		beego.NSRouter("/cs_test_libraries_item/simu/:id",&v1.CsTestLibItemController{},"options:Option"),
		beego.NSRouter("/cs_test_libraries_item/simu/collect/:id",&v1.CsTestLibItemController{},"put:UpdateCollect"),
		beego.NSRouter("/cs_test_libraries_item/simu/collect/:id",&v1.CsTestLibItemController{},"options:Option"),
		//GetSimuWithResource
		beego.NSRouter("/cs_test_libraries_item/simu_resource/:id",&v1.CsTestLibItemController{},"get:GetSimuWithResource"),
		beego.NSRouter("/cs_test_libraries_item/simu_resource/:id",&v1.CsTestLibItemController{},"options:Option"),

		beego.NSRouter("/cs_test_libraries_item/simu/:conn_id",&v1.CsTestLibItemController{},"post:AnswerSimuItem"),
		beego.NSRouter("/cs_test_libraries_item/:id/detail",&v1.CsTestLibItemController{},"get:GetOne"),
		beego.NSRouter("/cs_test_libraries_item/:id",&v1.CsTestLibItemController{},"options:Option"),
		beego.NSRouter("/cs_test_libraries_item/:id/detail",&v1.CsTestLibItemController{},"options:Option"),
		beego.NSRouter("/cs_test_libraries_item/rand/:amount",&v1.CsTestLibItemController{},"options:Option"),
		beego.NSRouter("/cs_test_libraries_item/rand/:amount",&v1.CsTestLibItemController{},"*:Random"),

		beego.NSRouter("/cs_test_libraries_item/randzx/:amount",&v1.CsTestLibItemController{},"options:Option"),
		beego.NSRouter("/cs_test_libraries_item/randzx/:amount",&v1.CsTestLibItemController{},"post:RandomZx"),

		beego.NSRouter("/cs_test_libraries_item/real/generate",&v1.CsTestLibItemController{},"options:Option"),
		beego.NSRouter("/cs_test_libraries_item/real/generate",&v1.CsTestLibItemController{},"post:Real"),

		beego.NSRouter("/cs_test_libraries_item/spirit/list",&v1.CsTestLibItemController{},"options:Option"),
		beego.NSRouter("/cs_test_libraries_item/spirit/list",&v1.CsTestLibItemController{},"get:ListSpirit"),

		beego.NSRouter("/cs_test_libraries_item/comp/generate",&v1.CsTestLibItemController{},"options:Option"),
		beego.NSRouter("/cs_test_libraries_item/comp/generate",&v1.CsTestLibItemController{},"post:Compo"),

		beego.NSRouter("/cs_test_libraries_item/:id/resource",&v1.CsTestLibItemController{},"get:GetResource"),
		beego.NSRouter("/cs_test_libraries_item/:id/resource",&v1.CsTestLibItemController{},"post:StoreResource"),
		beego.NSRouter("/cs_test_libraries_item/:id/resource",&v1.CsTestLibItemController{},"options:Option"),
		beego.NSRouter("/cs_test_libraries_item/resource/import",&v1.CsTestLibItemController{},"post:ImportResourceSubject"),
		beego.NSRouter("/cs_test_libraries_item/resource/import",&v1.CsTestLibItemController{},"options:Option"),

		beego.NSRouter("/cs_test_libraries_item/:id/resource",&v1.CsTestLibItemController{},"delete:DelResource"),
		beego.NSRouter("/cs_test_libraries_item/resource/transfer",&v1.CsTestLibItemController{},"post:SetToResrouce"),
		beego.NSRouter("/cs_test_libraries_item/resource/transfer",&v1.CsTestLibItemController{},"options:Option"),

		beego.NSRouter("/cs_test_libraries_item/:id/answer",&v1.CsTestLibItemAnswerController{},"post:Post"),
		beego.NSRouter("/cs_test_libraries_item/:id/answer",&v1.TokenCheckController{},"options:Option"),
		beego.NSRouter("/cs_test_libraries_item_answer/:id",&v1.CsTestLibItemAnswerController{},"delete:Del"),
		beego.NSRouter("/cs_test_libraries_item_answer/:id",&v1.TokenCheckController{},"options:Option"),


		beego.NSRouter("/admin_alive",&v1.UserController{},"get:HeartBeat"),
		beego.NSRouter("/admin_alive",&v1.UserController{},"options:Option"),

		beego.NSRouter("/alive",&v1.UserController{},"get:HeartBeat"),
		beego.NSRouter("/alive",&v1.UserController{},"options:Option"),

		beego.NSRouter("/sl_test_libraries",&v1.SlTestLibController{},"get:Get"),
		beego.NSRouter("/sl_test_libraries",&v1.SlTestLibController{},"post:Post"),
		beego.NSRouter("/sl_test_libraries/:id",&v1.SlTestLibController{},"delete:Del"),
		beego.NSRouter("/sl_test_libraries/:id",&v1.TokenCheckController{},"options:Option"),
		beego.NSRouter("/sl_test_libraries",&v1.TokenCheckController{},"options:Option"),

		beego.NSRouter("/sl_test_libraries_material/:id",&v1.SlTestItemMaterialController{},"get:Get"),
		beego.NSRouter("/sl_test_libraries_material/:id",&v1.SlTestItemMaterialController{},"post:Post"),
		beego.NSRouter("/sl_test_libraries_material/:id",&v1.TokenCheckController{},"options:Option"),

		//beego.NSRouter("/sl_test_libraries_material/:id",&v1.SlTestItemMaterialController{},"get:GetQuestion"),
		//beego.NSRouter("/sl_test_libraries_material/:id",&v1.TokenCheckController{},"options:Option"),

		beego.NSRouter("/sl_test_libraries_item/:id/question",&v1.SlTestItemController{},"post:Post"),
		beego.NSRouter("/sl_test_libraries_item/:id/question",&v1.SlTestItemController{},"delete:Del"),
		beego.NSRouter("/sl_test_libraries_item/:id/question",&v1.TokenCheckController{},"options:Option"),

		//beego.NSRouter("/stat/myquestion",&v1.StatController{},"get:GetQuestionCount"),
		//beego.NSRouter("/stat/myquestion",&v1.TokenCheckController{},"options:Option"),
		//beego.NSRouter("/extra/verify",&v1.ExtraController{},"post:SendVerify"),
		beego.NSRouter("/extra/verify",&v1.ExtraController{},"options:Option"),
		beego.NSRouter("/extra/verify",&v1.ExtraController{},"post:SendVerify"),
		beego.NSRouter("/extra/save",&v1.ExtraController{},"options:Option"),
		beego.NSRouter("/extra/save",&v1.ExtraController{},"post:Save"),
		beego.NSRouter("/extra/busverify",&v1.ExtraController{},"options:Option"),
		beego.NSRouter("/extra/busverify",&v1.ExtraController{},"post:SendBusVerify"),
	)
	//beego.Router("/api/v1/auth", &controllLers.AuthController{},"*:Login")
	//beego.Router("/api/v1/test_categories",&v1.TestCategoryController{},"*:List")
	//beego.Router("/api/v1/test_category",&v1.TestCategoryController{},"post,put:Store")
	//beego.Router("/api/v1/test_category",&v1.TestCategoryController{},"options:Option")
	//beego.Router("/api/v1/test_category/:id",&v1.TestCategoryController{},"delete:Del")
	//beego.Router("/api/v1/user",&v1.UserController{})
	beego.AddNamespace(ns)
}
